package com.xiaoma.tpo.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xiaoma.tpo.baseDao.BaseDaoImpl;
import com.xiaoma.tpo.baseDao.DefaultRowMapper;
import com.xiaoma.tpo.domain.BonusUserSign;

@Repository
public class UserSignDao extends BaseDaoImpl<BonusUserSign>{

    
    public BonusUserSign findLastSign(int userId) {
        String sql = "SELECT * FROM bonus_user_sign WHERE user_id = ? order by created_at desc limit 1";
        List<?> result = jdbcTemplate.query(sql, new DefaultRowMapper(BonusUserSign.class, getNameHandler()), userId);
        return result.size() > 0 ? (BonusUserSign)result.get(0) : null;
    }
    
}
